import { ConfigEnv, UserConfig, loadEnv } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv): UserConfig => {
  const root = process.cwd();
  const env = loadEnv(mode, root);
  return {
    plugins: [uni()],
    resolve: {
      alias: {
        '@': resolve('./src'),
      },
    },
    server: {
      // port: env.VITE_PORT as any,
      proxy: {
        '/https://33dd-60-26-51-138.ngrok-free.app': {
          target: 'https://33dd-60-26-51-138.ngrok-free.app',
          secure: false,
          changeOrigin: true,
        },
   
      },
    },
  };
};
